﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2013-11-4
/// Purpose: 		用户角色集合对象
/// ****************************************************************************
/// Modify By		Date			Remark
/// ****************************************************************************
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RB.Web.Security.Rdb
{
    /// <summary>
    /// 用户角色集合对象
    /// </summary>
    public class UserRoleSet : RB.Domain.RelationalMapping.IdKeyedConfigSet<UserRole, Guid>
    {
        internal List<UserRole> GetByUser(string appCode, Guid userId)
        {
            var q = from t in this.AsQueryable()
                    join t1 in (new UserAccountRoleSet()).AsQueryable() on t.Id equals t1.RoleId
                    where t.AppCode == appCode && t1.UserId == userId
                    select t;
            return q.ToList();
        }
    }
}
